﻿#define _CRT_SECURE_NO_WARNINGS//模拟实现strncpy
#include<stdio.h>
#include<string.h>
char* my_strncpy(char* p1, char* p2, size_t n)
{
	char* p = p1;
	while (n)
	{
		*p1 = *p2;
		p1++;
		p2++;
		n--;
	}
	return p;
}
int main()
{
	char arr1[] = "abcdef";
	char arr2[] = "mmmmm";
	/*strncpy(arr1, arr2, 2);*/
	printf("%s\n", arr1);
	char* pp = my_strncpy(arr1, arr2, 3);
	printf("%s\n", pp);
	return 0;
}
